Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast path for bytes #118

Merged
merged 2 commits into from
Nov 23, 2023
Merged

Fast path for bytes #118

merged 2 commits into from
Nov 23, 2023

Conversation

chriso
Copy link
Contributor

@chriso chriso commented Nov 23, 2023

When serializing byte array regions, we were forking the serializer and passing each byte through the encoder, even though no encoding is necessary. This PR adds a fast path.

                   │  before.txt  │              after.txt              │
                   │    sec/op    │   sec/op     vs base                │
RoundtripString-32   31.039µ ± 1%   5.099µ ± 1%  -83.57% (p=0.000 n=10)

                   │  before.txt   │              after.txt               │
                   │     B/op      │     B/op      vs base                │
RoundtripString-32   11.109Ki ± 0%   7.922Ki ± 0%  -28.69% (p=0.000 n=10)

                   │ before.txt │             after.txt             │
                   │ allocs/op  │ allocs/op   vs base               │
RoundtripString-32   79.00 ± 0%   72.00 ± 0%  -8.86% (p=0.000 n=10)

Copy link
Contributor

@achille-roussel achille-roussel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚤

@chriso chriso merged commit 7c96207 into main Nov 23, 2023
2 checks passed
@chriso chriso deleted the bytes branch November 23, 2023 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants